Optimal. Leaf size=95 \[ \frac{3 A+i B}{4 a^2 d (1+i \tan (c+d x))}-\frac{x (-B+3 i A)}{4 a^2}+\frac{A \log (\sin (c+d x))}{a^2 d}+\frac{A+i B}{4 d (a+i a \tan (c+d x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.228687, antiderivative size = 95, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 32, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.094, Rules used = {3596, 3531, 3475} \[ \frac{3 A+i B}{4 a^2 d (1+i \tan (c+d x))}-\frac{x (-B+3 i A)}{4 a^2}+\frac{A \log (\sin (c+d x))}{a^2 d}+\frac{A+i B}{4 d (a+i a \tan (c+d x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3596
Rule 3531
Rule 3475
Rubi steps
\begin{align*} \int \frac{\cot (c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx &=\frac{A+i B}{4 d (a+i a \tan (c+d x))^2}+\frac{\int \frac{\cot (c+d x) (4 a A-2 a (i A-B) \tan (c+d x))}{a+i a \tan (c+d x)} \, dx}{4 a^2}\\ &=\frac{3 A+i B}{4 a^2 d (1+i \tan (c+d x))}+\frac{A+i B}{4 d (a+i a \tan (c+d x))^2}+\frac{\int \cot (c+d x) \left (8 a^2 A-2 a^2 (3 i A-B) \tan (c+d x)\right ) \, dx}{8 a^4}\\ &=-\frac{(3 i A-B) x}{4 a^2}+\frac{3 A+i B}{4 a^2 d (1+i \tan (c+d x))}+\frac{A+i B}{4 d (a+i a \tan (c+d x))^2}+\frac{A \int \cot (c+d x) \, dx}{a^2}\\ &=-\frac{(3 i A-B) x}{4 a^2}+\frac{A \log (\sin (c+d x))}{a^2 d}+\frac{3 A+i B}{4 a^2 d (1+i \tan (c+d x))}+\frac{A+i B}{4 d (a+i a \tan (c+d x))^2}\\ \end{align*}
Mathematica [A] time = 0.965453, size = 184, normalized size = 1.94 \[ -\frac{i \sec ^2(c+d x) \left (\cos (2 (c+d x)) \left (-8 i A \log \left (\sin ^2(c+d x)\right )+4 A d x-i A-4 i B d x+B\right )+4 i A d x \sin (2 (c+d x))-A \sin (2 (c+d x))+8 A \sin (2 (c+d x)) \log \left (\sin ^2(c+d x)\right )-16 A \tan ^{-1}(\tan (d x)) (\cos (2 (c+d x))+i \sin (2 (c+d x)))-8 i A-i B \sin (2 (c+d x))+4 B d x \sin (2 (c+d x))+4 B\right )}{16 a^2 d (\tan (c+d x)-i)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.112, size = 177, normalized size = 1.9 \begin{align*}{\frac{B}{4\,{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{{\frac{3\,i}{4}}A}{{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{7\,\ln \left ( \tan \left ( dx+c \right ) -i \right ) A}{8\,{a}^{2}d}}-{\frac{{\frac{i}{8}}\ln \left ( \tan \left ( dx+c \right ) -i \right ) B}{{a}^{2}d}}-{\frac{A}{4\,{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{2}}}-{\frac{{\frac{i}{4}}B}{{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{2}}}-{\frac{A\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{8\,{a}^{2}d}}+{\frac{{\frac{i}{8}}B\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{{a}^{2}d}}+{\frac{A\ln \left ( \tan \left ( dx+c \right ) \right ) }{{a}^{2}d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.5515, size = 242, normalized size = 2.55 \begin{align*} \frac{{\left ({\left (-28 i \, A + 4 \, B\right )} d x e^{\left (4 i \, d x + 4 i \, c\right )} + 16 \, A e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) + 4 \,{\left (2 \, A + i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + A + i \, B\right )} e^{\left (-4 i \, d x - 4 i \, c\right )}}{16 \, a^{2} d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 3.75569, size = 221, normalized size = 2.33 \begin{align*} \frac{A \log{\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a^{2} d} + \begin{cases} \frac{\left (\left (4 A a^{2} d e^{2 i c} + 4 i B a^{2} d e^{2 i c}\right ) e^{- 4 i d x} + \left (32 A a^{2} d e^{4 i c} + 16 i B a^{2} d e^{4 i c}\right ) e^{- 2 i d x}\right ) e^{- 6 i c}}{64 a^{4} d^{2}} & \text{for}\: 64 a^{4} d^{2} e^{6 i c} \neq 0 \\x \left (\frac{7 i A - B}{4 a^{2}} - \frac{\left (7 i A e^{4 i c} + 4 i A e^{2 i c} + i A - B e^{4 i c} - 2 B e^{2 i c} - B\right ) e^{- 4 i c}}{4 a^{2}}\right ) & \text{otherwise} \end{cases} + \frac{x \left (- 7 i A + B\right )}{4 a^{2}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.29025, size = 165, normalized size = 1.74 \begin{align*} -\frac{\frac{2 \,{\left (A - i \, B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{2}} + \frac{2 \,{\left (7 \, A + i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a^{2}} - \frac{16 \, A \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{a^{2}} - \frac{21 \, A \tan \left (d x + c\right )^{2} + 3 i \, B \tan \left (d x + c\right )^{2} - 54 i \, A \tan \left (d x + c\right ) + 10 \, B \tan \left (d x + c\right ) - 37 \, A - 11 i \, B}{a^{2}{\left (\tan \left (d x + c\right ) - i\right )}^{2}}}{16 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]